package  
{
	/**
	 * ...
	 * @author Felix Fleiß, Martina Rasch
	 */
	import net.flashpunk.Entity;
	import net.flashpunk.graphics.Image;
	import net.flashpunk.FP;
	import net.flashpunk.utils.Data;
	
	public class Background extends Entity
	{
		private var speed:Number;
		[Embed(source = 'res/galaxy.png')] 
		private const GALAXY:Class;
		private var screen_width:int;
		public function Background() 
		{
			screen_width =  Data.readInt("screen_width");
			speed = 0;
			graphic = new Image(GALAXY);
		}
		
		override public function update():void {
			super.update();
			x -= FP.elapsed * speed;
			//trace(x);
			if (x - screen_width < -5000)
				x = 0;
		}
		public function setSpeed(bgSpeed:Number):void {
			speed = bgSpeed*100;
		}
	}

}